<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
test(() => {
    assert_selection(
        '<div contenteditable>X|Y</div>',
        'insertHTML <div>foo</div><span><div>bar</div></span><br class="Apple-interchange-newline">',
        '<div contenteditable>Xfoo<div>bar</div>|Y</div>',
        'insert an interchange newline into text');

    assert_selection(
        '<div contenteditable><div>f^oo</div>b|ar</div>',
        'insertHTML <div>bar</div>baz<br class="Apple-interchange-newline">',
        '<div contenteditable><div>fbar</div>baz<div>|ar</div></div>',
        'insert an interchange newline into multiple blocks');

    assert_selection(
        '<div contenteditable>|</div>',
        'insertHTML foo<div>bar</div><br class="Apple-interchange-newline">',
        '<div contenteditable>foo<div>bar</div><div>|<br></div></div>',
        'content ending with an interchange newline');

    assert_selection(
        '<div contenteditable>foo|</div>',
        'insertHTML <br class="Apple-interchange-newline">bar',
        '<div contenteditable>foo<div>bar|</div></div>',
        'content starting with an interchange newline');
}, 'insert an interchange newline');
</script>
